<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <!-- 
            Replace path to template, title, header and body
            with actual data.
    -->
    <ui:composition template="/templates/template.xhtml">
        <ui:define name="pageTitle">Alterar Cliente</ui:define>
        <ui:define name="titleBody">Alterar Cliente</ui:define>
        <ui:define name="body">
            <h:panelGroup styleClass="painel">
                <h:message for="formulario"/>
                <h:form id="formulario">
                    <h:panelGroup id="idCliente">
                        <table style="margin: auto; text-align: left;" id="estiloTexto">
                            <tr>
                                <td>
                                    <h:outputText value="Nome:" />
                                </td>
                                <td>
                                    <h:inputText id="idNome" value="#{clienteCtrl.cliente.nome}" style="margin-left: 25px;" maxlength="25" required="true" ></h:inputText>
                                    <h:message for="idNome"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <h:outputText value="CPF:" />
                                </td>
                                <td>
                                    <h:inputText id="idCpf" value="#{clienteCtrl.cliente.cpf}" style="margin-left: 25px;" maxlength="25" required="true">
                                        <f:validator validatorId="CPFValidator" />
                                    </h:inputText>
                                    <h:message for="idCpf"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <h:outputText value="RG:" />
                                </td>
                                <td>
                                    <h:inputText id="idRg" value="#{clienteCtrl.cliente.rg}" style="margin-left: 25px;" maxlength="25" required="true"></h:inputText>
                                    <h:message for="idRg"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <h:outputText value="Data de Nascimento" />
                                </td>
                                <td>
                                    <h:inputText id="idDataNascimento" value="#{clienteCtrl.cliente.dataNascimento}" style="margin-left: 25px;" maxlength="10" required="true" converterMessage="Exemplo: 21/03/2007">
                                        <f:convertDateTime pattern="dd/MM/yyyy"/>                                   
                                    </h:inputText>
                                    <h:message for="idDataNascimento"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <h:outputText value="Telefone:" />
                                </td>
                                <td>
                                    <h:inputText id="Telefone" value="#{clienteCtrl.cliente.telefone}" style="margin-left: 25px;" maxlength="25"></h:inputText>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <h:outputText value="Email:" />
                                </td>
                                <td>
                                    <h:inputText id="idEmail" value="#{clienteCtrl.cliente.email}" style="margin-left: 25px;" maxlength="30">
                                        <f:validator id="idEmailValidator" validatorId="EmailValidator"/>
                                    </h:inputText>
                                    <h:message for="idEmail"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <h:outputText value="Endereço:" />
                                </td>
                                <td>
                                    <h:inputText id="Endereco" value="#{clienteCtrl.cliente.endereco}" style="margin-left: 25px;" maxlength="40"></h:inputText>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <h:outputText value="Funcionario:" />
                                </td>
                                <td>
                                    <h:selectOneMenu id="idFuncionario" value="#{clienteCtrl.idFuncionarioEscolhido}" style="margin-left: 25px;" required="true">
                                        <f:selectItem itemValue="" itemLabel="Selecione..."/>
                                        <f:selectItems value="#{clienteCtrl.carregarFuncionarios()}"/>
                                    </h:selectOneMenu>
                                    <h:message for="idFuncionario"/>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <h:commandButton value="Alterar"  actionListener="#{clienteCtrl.alterarCliente()}"></h:commandButton>
                                </td>
                            </tr>
                        </table>
                    </h:panelGroup>
                </h:form>
                <a href="listarCliente.xhtml" style="margin-left: 25px; margin-top: -35px;"> Listar Clientes</a>
                <br /><br /><br /><br /><br /><br /><br />
                <br /><br /><br /><br /><br /><br /><br />
                <br /><br /><br />
            </h:panelGroup>
        </ui:define>
    </ui:composition>

</html>